package com.atguigu.srb.core.controller;

import com.atguigu.srb.common.result.R;
import com.atguigu.srb.core.service.IntegralGradeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description TODO
 * @Classname AdminIntegralGradeController
 * @Date 2022/11/16 18:00
 * @Created by 16342
 * @Author wangchengshan
 */
@RestController
@CrossOrigin
@Api(tags = "测试",value = "测试value")
@RequestMapping("admin/core/integralGrade")
@Slf4j
public class AdminIntegralGradeController {
    @Resource
    private IntegralGradeService integralGradeService;

    @ApiOperation("查询")
    @GetMapping("/list")
    public R listAll(){
        log.info("info");
        log.error("error");
        log.debug("debug");
        log.warn("warn");
        return R.ok().data("list",integralGradeService.list());
    }

    @ApiOperation("删除")
    @DeleteMapping("deleteById/{id}")
    public R deleteById(@ApiParam("id") @PathVariable("id")Long id){
        Boolean isSuccess = integralGradeService.deleteById(id);
        if(isSuccess){
            return R.ok().message("成功");
        }else {
            return R.error().message("失败");
        }
    }
}
